# 1 "fake-checksum.S"
# 37 "fake-checksum.S"
.text
.align 4
.globl csum_partial
csum_partial:

	pushl	%eax
	pushl	%ebx
	leal	4(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+0,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
        pushl %esi
	pushl	%eax
	pushl	%ebx
	leal	4(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+32,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
        pushl %ebx
	pushl	%eax
	pushl	%ebx
	leal	 20(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+64,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 20(%esp),%eax # Function arg: unsigned int sum

	pushl	%eax
	pushl	%ebx
	leal	 16(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+96,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 16(%esp),%ecx # Function arg: int len

	pushl	%eax
	pushl	%ebx
	leal	 12(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+128,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 12(%esp),%esi # Function arg: const unsigned char *buf


        testl $2, %esi
	pushfl
	addl	$7,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jnz 30f
10:

        movl %ecx, %edx
        movl %ecx, %ebx
        andl $0x7c, %ebx
        shrl $7, %ecx
        addl %ebx,%esi
        shrl $2, %ebx
        negl %ebx
#        lea 45f(%ebx,%ebx,2), %ebx
	# hand coded by Wen
	imull $47, %ebx # 17 (cacheprof_mem_hooks) + 3 + 16 (cacheprof_instr_hooks) + 9 (cost center adjustment) + 2 (pushfl+popfl)
	lea 45f(%ebx), %ebx
	# end of coded by Wen
        testl %esi, %esi
	pushfl
	addl	$10,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jmp *%ebx

        # Handle 2-byte-aligned regions

20:
	pushl	%eax
	pushl	%ebx
	leal	 (%esi), %eax
	movl	$.Lcacheprof_magic_buckets+160,%ebx
	call	cacheprof_hook_Rd2
	popl	%ebx
	popl	%eax
 addw (%esi), %ax
        lea 2(%esi), %esi
        adcl $0, %eax
	pushfl
	addl	$4,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jmp 10b

30:
 subl $2, %ecx
	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        ja 20b
	pushfl
	addl	$1,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        je 32f
	pushl	%eax
	pushl	%ebx
	leal	 (%esi), %eax
	movl	$.Lcacheprof_magic_buckets+192,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movzbl (%esi),%ebx # csumming 1 byte, 2-aligned

        addl %ebx, %eax
        adcl $0, %eax
	pushfl
	addl	$4,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jmp 80f
32:

	pushl	%eax
	pushl	%ebx
	leal	 (%esi), %eax
	movl	$.Lcacheprof_magic_buckets+224,%ebx
	call	cacheprof_hook_Rd2
	popl	%ebx
	popl	%eax
        addw (%esi), %ax # csumming 2 bytes, 2-aligned

        adcl $0, %eax
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jmp 80f

40:

	pushl	%eax
	pushl	%ebx
	leal	 -128(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+256,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        addl -128(%esi), %eax
        .irp p,124,120,116,112,108,104,100, 96, 92, 88, 84, 80, 76, 72, 68, 64, 60, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4
	pushfl
	pushl	%eax
	pushl	%ebx
	leal	-\p(%esi), %eax
	# hand coded by Wen
	movl	$\p, %ebx	#write to correct CC
	shll	$3, %ebx	#CC = base + p * 8 (32/4)
	addl	$.Lcacheprof_magic_buckets+288,%ebx
	# end of hand coded by Wen
#	movl	$.Lcacheprof_magic_buckets+288,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
	popfl
        adcl    -\p(%esi),%eax
	pushfl
	addl	$1,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        .endr
45:

        lea 128(%esi), %esi
        adcl $0, %eax
        dec %ecx
	pushfl
	addl	$4,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jge 40b
        movl %edx, %ecx
	pushfl
	addl	$1,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
50:
 andl $3, %ecx
	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jz 80f

        # Handle the last 1-3 bytes without jumping

        notl %ecx # 1->2, 2->1, 3->0, higher bits are masked

        movl $0xffffff,%ebx # by the shll and shrl instructions

        shll $3,%ecx
        shrl %cl,%ebx
	pushl	%eax
	pushl	%ebx
	leal	 -128(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1312,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        andl -128(%esi),%ebx # esi is 4-aligned so should be ok

        addl %ebx,%eax
        adcl $0,%eax
	pushfl
	addl	$7,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
80:

	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1344,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        popl %ebx
	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1376,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        popl %esi
	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1408,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        ret
# 117 "fake-checksum.S"




.align 4
.globl csum_partial_copy



# 137 "fake-checksum.S"

csum_partial_copy:

	pushl	%eax
	pushl	%ebx
	leal	4(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1440,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
        pushl %ebx
	pushl	%eax
	pushl	%ebx
	leal	4(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1472,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
        pushl %edi
	pushl	%eax
	pushl	%ebx
	leal	4(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1504,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
        pushl %esi
	pushl	%eax
	pushl	%ebx
	leal	 12+4(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1536,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 12+4(%esp),%esi #src

	pushl	%eax
	pushl	%ebx
	leal	 12+8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1568,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 12+8(%esp),%edi #dst

	pushl	%eax
	pushl	%ebx
	leal	 12+12(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1600,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 12+12(%esp),%ecx #len

	pushl	%eax
	pushl	%ebx
	leal	 12+16(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+1632,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl 12+16(%esp),%eax #sum

        movl %ecx, %edx
        movl %ecx, %ebx
        shrl $6, %ecx
        andl $0x3c, %ebx
        negl %ebx
        subl %ebx, %esi
        subl %ebx, %edi
#        lea 3f(%ebx,%ebx), %ebx
	# hand coded by Wen
	imul $60, %ebx	# 17 (cacheprof_memory_hooks) * 2 + 8 + 16 (cacheprof_instr_hooks) + 2 (pushfl + popfl)
        lea 3f(%ebx), %ebx
	# end of hand coded by Wen
        testl %esi, %esi
	pushfl	#added by Wen
        testl %esi, %esi
	pushfl
	addl	$17,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jmp *%ebx
1:
 addl $64,%esi
        addl $64,%edi
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -64(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1664,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl -64(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 addl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -64(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+1696,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -64(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -60(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1728,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -60(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -60(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+1760,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -60(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -56(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1792,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -56(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -56(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+1824,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -56(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -52(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1856,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -52(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -52(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+1888,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -52(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;

	pushl	%eax
	pushl	%ebx
	leal	 -48(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1920,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl -48(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -48(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+1952,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -48(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -44(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+1984,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -44(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -44(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2016,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -44(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -40(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2048,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -40(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -40(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2080,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -40(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -36(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2112,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -36(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -36(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2144,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -36(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;

	pushl	%eax
	pushl	%ebx
	leal	 -32(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2176,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl -32(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -32(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2208,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -32(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -28(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2240,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -28(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -28(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2272,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -28(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -24(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2304,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -24(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -24(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2336,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -24(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -20(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2368,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -20(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -20(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2400,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -20(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;

	pushl	%eax
	pushl	%ebx
	leal	 -16(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2432,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        movl -16(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -16(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2464,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -16(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -12(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2496,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -12(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -12(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2528,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -12(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -8(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2560,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -8(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -8(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2592,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -8(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;
	pushl	%eax
	pushl	%ebx
	leal	 -4(%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2624,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
 movl -4(%esi), %ebx;
 ;
	popfl	# hand added by Wen
 adcl %ebx, %eax ;
	pushfl	# hand added by Wen
	pushl	%eax
	pushl	%ebx
	leal	 -4(%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2656,%ebx
	call	cacheprof_hook_Wr4
	popl	%ebx
	popl	%eax
 movl %ebx, -4(%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
 ;

#	no longer needed because instructions are already count
#	pushfl
#	addl	$50,cacheprof_icount
#	adcl	$0,4+cacheprof_icount
#	popfl
3:
	popfl	# hand added by Wen
 adcl $0,%eax
        dec %ecx
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jge 1b
4:
 andl $3, %edx
	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jz 7f
        cmpl $2, %edx
	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        jb 5f
	pushl	%eax
	pushl	%ebx
	leal	 (%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2688,%ebx
	call	cacheprof_hook_Rd2
	popl	%ebx
	popl	%eax
movw (%esi), %dx;

        leal 2(%esi), %esi
	pushl	%eax
	pushl	%ebx
	leal	 (%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2720,%ebx
	call	cacheprof_hook_Wr2
	popl	%ebx
	popl	%eax
movw %dx, (%edi);
	pushfl
	addl	$3,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl

        leal 2(%edi), %edi
	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        je 6f
        shll $16,%edx
	pushfl
	addl	$1,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
5:

	pushl	%eax
	pushl	%ebx
	leal	 (%esi), %eax
	movl	$.Lcacheprof_magic_buckets+2752,%ebx
	call	cacheprof_hook_Rd1
	popl	%ebx
	popl	%eax
movb (%esi), %dl;

	pushl	%eax
	pushl	%ebx
	leal	 (%edi), %eax
	movl	$.Lcacheprof_magic_buckets+2784,%ebx
	call	cacheprof_hook_Wr1
	popl	%ebx
	popl	%eax
movb %dl, (%edi);

	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
6:
 addl %edx, %eax
        adcl $0, %eax
	pushfl
	addl	$2,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
7:

	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+2816,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        popl %esi
	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+2848,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        popl %edi
	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+2880,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
        popl %ebx
	pushl	%eax
	pushl	%ebx
	leal	8(%esp), %eax
	movl	$.Lcacheprof_magic_buckets+2912,%ebx
	call	cacheprof_hook_Rd4
	popl	%ebx
	popl	%eax
	pushfl
	addl	$4,cacheprof_icount
	adcl	$0,4+cacheprof_icount
	popfl
        ret

	#
	# --- start of the cost centers ---
	#
	.data
	.align 4
.Lcacheprof_magic_table:
	# number of filenames, funcnames, points, cc addr
	.long 1
	.long 10
	.long 92
	.long .Lcacheprof_magic_buckets
	.asciz "unknown"
	.asciz "10(unknown)"
	.asciz "20(unknown)"
	.asciz "30(unknown)"
	.asciz "32(unknown)"
	.asciz "40(unknown)"
	.asciz "csum_partial_copy(unknown)"
	.asciz "1(unknown)"
	.asciz "3(unknown)"
	.asciz "4(unknown)"
	.asciz "6(unknown)"
.Lcacheprof_magic_buckets:
	 # (0, 0, -1)
	.long 0
	.long 0
	.long -1
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, -1)
	.long 0
	.long 0
	.long -1
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, -1)
	.long 0
	.long 0
	.long -1
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, -1)
	.long 0
	.long 0
	.long -1
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, -1)
	.long 0
	.long 0
	.long -1
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 1)
	.long 0
	.long 0
	.long 1
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 2)
	.long 0
	.long 0
	.long 2
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 3)
	.long 0
	.long 0
	.long 3
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 4)
	.long 0
	.long 0
	.long 4
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 5)
	.long 0
	.long 0
	.long 5
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 6)
	.long 0
	.long 0
	.long 6
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 8)
	.long 0
	.long 0
	.long 8
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 8)
	.long 0
	.long 0
	.long 8
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 8)
	.long 0
	.long 0
	.long 8
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 8)
	.long 0
	.long 0
	.long 8
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 9)
	.long 0
	.long 0
	.long 9
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 9)
	.long 0
	.long 0
	.long 9
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 9)
	.long 0
	.long 0
	.long 9
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	 # (0, 0, 9)
	.long 0
	.long 0
	.long 9
	.long 0
	.long 0
	.long 0
	.long 0
	.long 0
	#
	# ---  end of the cost centers  ---
	#

.section .ctors,"aw"
	.long cacheprof_register2_me
.section .dtors,"aw"
	.long cacheprof_finalise2_me
	
.text
        .align 4

cacheprof_hook_Rd1:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Rd1
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_hook_Rd2:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Rd2
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_hook_Rd4:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Rd4
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret

cacheprof_hook_Rd8:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Rd8
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret

cacheprof_hook_Mo1:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Mo1
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_hook_Mo2:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Mo2
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_hook_Mo4:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Mo4
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret

cacheprof_hook_Mo8:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Mo8
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret

cacheprof_hook_Wr1:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Wr1
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_hook_Wr2:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Wr2
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_hook_Wr4:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Wr4
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret

cacheprof_hook_Wr8:
	pushl %ecx
	pushl %edx
	pushl %esi
	pushl %edi
	pushl %ebp
	pushfl
	pushl %eax         #  eax has addr referenced
	pushl %ebx         #  ebx has addr of cc
	call cacheprof_log_Wr8
	addl $8,%esp
	popfl
	popl %ebp
	popl %edi
	popl %esi
	popl %edx
	popl %ecx
	ret
	
cacheprof_register2_me:
        pushal
	pushfl
	movl $.Lcacheprof_magic_table,%eax
	pushl %eax
	call cacheprof_register2_module
	popl %eax
	popfl
	popal
	ret

cacheprof_finalise2_me:
        pushal
	pushfl
	movl $.Lcacheprof_magic_table,%eax
	pushl %eax
	call cacheprof_finalise2_module
	popl %eax
	popfl
	popal
	ret
	

